//
//  HotWordsCollectionViewCell.m
//  GiftSay
//
//  Created by QQn1993 on 16/1/9.
//  Copyright © 2016年 liyinkai. All rights reserved.
//

#import "HotWordsCollectionViewCell.h"

@interface HotWordsCollectionViewCell ()

@property (nonatomic,strong)UILabel *label;

@end

@implementation HotWordsCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        if ([[NSUserDefaults standardUserDefaults] boolForKey:@"NightMode"] == YES){
            self.backgroundColor = kNightModeColor;
        }
        else{
            self.backgroundColor = [UIColor whiteColor];
        }
        
        self.contentView.layer.masksToBounds = YES;
        self.contentView.layer.borderColor = [UIColor lightGrayColor].CGColor;
        self.contentView.layer.borderWidth = 1;
        self.contentView.layer.cornerRadius = 2;
        
        self.label = [[UILabel alloc] init];
        self.label.textAlignment = NSTextAlignmentCenter;
        self.label.font = [UIFont systemFontOfSize:14*SCREEN_WIDTH];
        
        [self.contentView addSubview:self.label];
    }
    return self;
}

- (void)setName:(NSString *)name
{
    if (_name != name) {
        _name = name;
    }
    
    self.label.text = name;
}

- (void)setSelect:(BOOL)select
{
    if (_select != select) {
        _select = select;
    }
    
//    if (select == YES) {
//        self.label.text = [self.label.text stringByReplacingOccurrencesOfString:@"▽" withString:@"△"];
//    }
//    
//    else if (select == NO){
//        self.label.text = [self.label.text stringByReplacingOccurrencesOfString:@"△" withString:@"▽"];
//    }
    
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    self.label.frame = self.contentView.bounds;
    if ([[NSUserDefaults standardUserDefaults] boolForKey:@"NightMode"] == YES) {
        self.label.textColor = [UIColor whiteColor];
    } else {
        self.label.textColor = [UIColor blackColor];
    }
}

@end
